<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="../js/vue.min.js"></script>
    <script src="../js/vue-router.js"></script>
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <router-link to="/a/222">路径a</router-link>
      <router-view></router-view>
    </div>
    <script>
      // 模板一
      const t1 = {
        props: ["id"],
        template: `<div style="width:400px;height:200px;border:blue 1px solid">
            index<br/>
            {{id}}
            </div>`,
      };

      // 配置路由
      const router = new VueRouter({
        routes: [
          {
            path: "/a/:id",
            name: "r1",
            alias: "/user",
            component: t1,
            props: true,
          },
        ],
      });
      var vue = new Vue({
        el: "#app",
        router: router,
      });
    </script>
  </body>
</html>
